package com.eascs.fp.uc.untils;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Random;

public class ValiCodeUtils {
	private static final int NUMBER = 6;
	private static final String[] beforeShuffle = new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A",
			"B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V",
			"W", "X", "Y", "Z" };

	public static String generateCode() {
		Random random = new Random();
		List<String> list = Arrays.asList(beforeShuffle);
		Collections.shuffle(list);
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < list.size(); i++) {
			sb.append(list.get(i));
		}
		String afterShuffle = sb.toString();
		int min = random.nextInt(list.size() - NUMBER - 1);
		int max = min + NUMBER;
		String result = afterShuffle.substring(min, max);
		return result;
	}

	public static void main(String[] args) {
		 for (int i = 0; i < 10000; i++) {
			 System.out.println(generateCode());
		 }
	}

}
